<?php

use think\migration\Seeder;

class SystemSettingData extends Seeder
{
    /**
     * 系统设置，目前18参数
     */
    public function run()
    {
        $table = $this->table('system_setting');
        //step1:系统级别的（2）
        $rowsSystem  = [
            [
                'type'        => 'system',
                'type2'       => 'exceed',
                'name_en'     => 'correlation_index',
                'name_zh'     => '相关指数的界定值',
                'value'       => '0.75',
                'details'     => '相关指数的界定值，高于此值就显示，低于此值不显示',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'system',
                'type2'       => 'exceed',
                'name_en'     => 'high_contribution_value',
                'name_zh'     => '贡献度高的界定值',
                'value'       => '0.3',
                'details'     => '贡献度高的界定值，高于此值就是贡献度高',
                'region_id'   => '53',
                'create_time' => time(),
            ]
        ];
        //step2:报警级别(9)
        $rowsAlarm = [
            //step2-1:报警-站点报警（7参）
            [
                'type'        => 'station_alarm',
                'type2'       => 'exceed',
                'name_en'     => 'aqi',
                'name_zh'     => 'AQI超标',
                'value'       => '200',
                'details'     => '站点AQI超标（相关性），超过限定值就开始报警，向报警表插入数值',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'station_alarm',
                'type2'       => 'exceed',
                'name_en'     => 'pm10',
                'name_zh'     => 'PM10超标',
                'value'       => '200',
                'details'     => '站点PM10超标，超过限定值就开始报警，向报警表插入数值',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'station_alarm',
                'type2'       => 'exceed',
                'name_en'     => 'pm25',
                'name_zh'     => 'PM2.5超标',
                'value'       => '200',
                'details'     => '站点PM2.5超标，超过限定值就开始报警，向报警表插入数值',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'station_alarm',
                'type2'       => 'exceed',
                'name_en'     => 'so2',
                'name_zh'     => 'SO2超标',
                'value'       => '200',
                'details'     => '站点SO2超标，超过限定值就开始报警，向报警表插入数值',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'station_alarm',
                'type2'       => 'exceed',
                'name_en'     => 'no2',
                'name_zh'     => 'NO2超标',
                'value'       => '200',
                'details'     => '站点NO2超标，超过限定值就开始报警，向报警表插入数值',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'station_alarm',
                'type2'       => 'exceed',
                'name_en'     => 'co',
                'name_zh'     => 'CO超标',
                'value'       => '200',
                'details'     => '站点CO超标，超过限定值就开始报警，向报警表插入数值',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'station_alarm',
                'type2'       => 'exceed',
                'name_en'     => 'o3',
                'name_zh'     => 'O3超标',
                'value'       => '200',
                'details'     => '站点SO2超标，超过限定值就开始报警，向报警表插入数值',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            //step2-2:报警-工况报警-超标（目前1参）
            [
                'type'        => 'company_alarm',
                'type2'       => 'exceed',
                'name_en'     => 'drain_concentration',
                'name_zh'     => '排口浓度',
                'value'       => '0.75',
                'details'     => '工况排口浓度超标，超过限定值就开始报警，向报警表插入数值',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            //step2-3:报警-工况报警-停运（目前就1参）
            [
                'type'        => 'company_alarm',
                'type2'       => 'stop',
                'name_en'     => 'SCRfanyingqiXAIGqianyandaoliuliang_1_b',
                'name_zh'     => 'SCR反应器B-AIG前烟道流量(机组1-锅炉B)',
                'value'       => '0',
                'details'     => 'SCR反应器B-AIG前烟道流，当数据为0时就开始报警，向报警表插入数值',
                'region_id'   => '53',
                'create_time' => time(),
            ]
        ];
        //step3:工况配置（1）
        $rowsCompany = [
            [
                'type'        => 'company_alarm',
                'type2'       => 'exceed',
                'name_en'     => 'heavy_pollution',
                'name_zh'     => '重污染报警',
                'value'       => '0',
                'details'     => '重污染报警超过200就报警',
                'region_id'   => '53',
                'create_time' => time(),
            ]
        ];

        //step4:天气预报配置（4）
        $rowsWeather = [
            [
                'type'        => 'weather',
                'type2'       => '',
                'name_en'     => 'high_temperature',
                'name_zh'     => '气温最高值',
                'value'       => '49.6',
                'details'     => '单位：摄氏度，气温最高值，从https://baike.baidu.com/item/%E6%B0%94%E6%B8%A9/1699232?fr=aladdin#5_1获取',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'weather',
                'type2'       => '',
                'name_en'     => 'low_temperature',
                'name_zh'     => '气温最哇值',
                'value'       => '-52.3',
                'details'     => '单位：摄氏度，气温最低值，从https://baike.baidu.com/item/%E6%B0%94%E6%B8%A9/1699232?fr=aladdin#5_1获取',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'weather',
                'type2'       => '',
                'name_en'     => 'high_wind_power',
                'name_zh'     => '风力最大值',
                'value'       => '17',
                'details'     => '单位：级，《中华人民共和国国家环境保护标准 GB/T  35663-2017》获取',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'weather',
                'type2'       => '',
                'name_en'     => 'low_wind_power',
                'name_zh'     => '风力最小值',
                'value'       => '0',
                'details'     => '单位：级，《中华人民共和国国家环境保护标准 GB/T  35663-2017》获取',
                'region_id'   => '53',
                'create_time' => time(),
            ]
        ];

        //step5:站点配置（2）
        $rowsStation = [
            [
                'type'        => 'station',
                'type2'       => '',
                'name_en'     => 'high_aqi',
                'name_zh'     => 'aqi的最大值',
                'value'       => '500',
                'details'     => '无单位，从《中华人民共和国国家环境保护标准 HJ 633—2012》获取',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'weather',
                'type2'       => '',
                'name_en'     => 'low_aqi',
                'name_zh'     => 'aqi的最小值',
                'value'       => '0',
                'details'     => '无单位，从《中华人民共和国国家环境保护标准 HJ 633—2012》获取',
                'region_id'   => '53',
                'create_time' => time(),
            ]
        ];

        //step6:NC数据配置（6）
        $rowsNc = [
            [
                'type'        => 'nc',
                'type2'       => '',
                'name_en'     => 'nc_start_longitude',
                'name_zh'     => 'NC数据开始的经度',
                'value'       => '36.0',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'nc',
                'type2'       => '',
                'name_en'     => 'nc_latitude',
                'name_zh'     => 'NC数据开始的纬度',
                'value'       => '112.7',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'nc',
                'type2'       => '',
                'name_en'     => 'nc_end_longitude',
                'name_zh'     => 'NC数据结束的经度',
                'value'       => '36.5',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'nc',
                'type2'       => '',
                'name_en'     => 'nc_end_latitude',
                'name_zh'     => 'NC数据结束的纬度',
                'value'       => '113.3',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'nc',
                'type2'       => '',
                'name_en'     => 'nc_grid_row_number',
                'name_zh'     => 'NC数据的网格行数',
                'value'       => '51',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'nc',
                'type2'       => '',
                'name_en'     => 'nc_grid_column_number',
                'name_zh'     => 'NC数据的网格列数',
                'value'       => '61',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
        ];

        //step7:源清单数据配置（6）
        $rowsSourceList = [
            [
                'type'        => 'source',
                'type2'       => '',
                'name_en'     => 'source_start_longitude',
                'name_zh'     => '源清单开始的经度',
                'value'       => '36.00683393',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'source',
                'type2'       => '',
                'name_en'     => 'source_start_latitude',
                'name_zh'     => '源清单开始的纬度',
                'value'       => '112.6501903',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'source',
                'type2'       => '',
                'name_en'     => 'source_end_longitude',
                'name_zh'     => '源清单结束的经度',
                'value'       => '36.65680998',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'source',
                'type2'       => '',
                'name_en'     => 'source_end_latitude',
                'name_zh'     => '源清单结束的纬度',
                'value'       => '113.3509468',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'source',
                'type2'       => '',
                'name_en'     => 'source_grid_row_number',
                'name_zh'     => '源清单经纬度网格行数',
                'value'       => '72',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ],
            [
                'type'        => 'source',
                'type2'       => '',
                'name_en'     => 'source_grid_column_number',
                'name_zh'     => '源清单经纬度网格列数',
                'value'       => '63',
                'details'     => '',
                'region_id'   => '53',
                'create_time' => time(),
            ]
        ];
        $rows = array_merge($rowsSystem, $rowsAlarm, $rowsCompany, $rowsWeather, $rowsStation, $rowsNc, $rowsSourceList);
        $table->insert($rows)->save();
    }
}